package com.yaoge.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 异常处理器
 */
@ControllerAdvice
public class ExceptionControllerr {

    @ExceptionHandler
    public String handleArithmeticException(Exception ex, Model model){
        model.addAttribute("ex",ex);
        return "error";
    }
}
